package datapackage

//Dimension 维度
type Dimension struct {
	Name        string      `xml:"name,attr"`
	ForeignKey  string      `xml:"foreignKey,attr"`
	Type        string      `xml:"type,attr"` //TimeDimension或者不填
	Hierarchies []Hierarchy `xml:"Hierarchy"`
	Caption     string      `xml:"caption,attr"`
	RedisIndex  int         `xml:"redisIndex"`
}

//DimensionUsage 引用维度
type DimensionUsage struct {
	Name       string `xml:"name,attr"`
	ForeignKey string `xml:"foreignKey,attr"`
	Relation   string `xml:"relation,attr"`
	Division   string `xml:"division,attr"`
}

//Property 属性，用于级别中的关联属性
type Property struct {
	Name     string `xml:"name,attr"`
	Column   string `xml:"column,attr"`
	DataType string `xml:"dataType,attr"`
}

//Closure 表，用于父子级别中
type Closure struct {
	ParentColumn string `xml:"parentColumn,attr"`
	ChildColumn  string `xml:"childColumn,attr"`
	Table        Table
}

//Level 级别
type Level struct {
	Name            string `xml:"name,attr"`
	Column          string `xml:"column,attr"`
	NameColumn      string `xml:"nameColumn,attr"`
	DataType        string `xml:"type,attr"`      //Numeric，String，Date，BooLean
	LevelType       string `xml:"levelType,attr"` //TimeYears，TimeQuarters，TimeMonths，TimeWeeks，TimeDays
	ParentColumn    string `xml:"parentColumn,attr"`
	NullParentValue string `xml:"nullParentValue,attr"`
	Oridinal        int    `xml:"oridinal,attr"`
	OrderColumn     string `xml:"orderColumn,attr"`
	OrderDirection  string `xml:"orderDirection,attr"`
	Closure         Closure
	Properties      []Property `xml:"Property"`
}

//Member 成员
type Member struct {
	ID       string
	Name     string
	HasChild bool
}

//Hierarchy 层级
type Hierarchy struct {
	Name          string  `xml:"name,attr"`
	HasAll        bool    `xml:"hasAll,attr"`
	AllMemberName string  `xml:"allMemberName,attr"`
	PrimaryKey    string  `xml:"primaryKey,attr"`
	Table         Table   `xml:"Table"`
	Levels        []Level `xml:"Level"`
}
